package com.sfac.javaSpringBoot.modules.test.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.sfac.javaSpringBoot.modules.common.entity.AbstractEntity;

import javax.persistence.*;
import java.util.List;

/**
 * @Description Student
 * @Author HymanHu
 * @Date 2021/9/14 13:53
 */
@Entity
@Table(name="test_student")
public class Student extends AbstractEntity {
    private String studentName;
    private int age;
    private String email;

    @OneToOne(targetEntity= Card.class, cascade = CascadeType.ALL, fetch = FetchType.EAGER)
    @JoinColumn(name="card_id")
    private Card card;

    @ManyToMany(mappedBy = "students", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
    @JsonIgnore
    private List<Clazz> clazzes;

    public String getStudentName() {
        return studentName;
    }

    public void setStudentName(String studentName) {
        this.studentName = studentName;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Card getCard() {
        return card;
    }

    public void setCard(Card card) {
        this.card = card;
    }

    public List<Clazz> getClazzes() {
        return clazzes;
    }

    public void setClazzes(List<Clazz> clazzes) {
        this.clazzes = clazzes;
    }
}
